package com.teamwork.module01.controller;


import com.teamwork.common.entity.module01.Class;
import com.teamwork.common.entity.module01.Classroom;
import com.teamwork.common.result.Result;
import com.teamwork.module01.service.ClassroomService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/api/mod01/classroom")
public class ClassroomController {
    @Resource
    private ClassroomService classroomService;


    @GetMapping("/getbynum")
    public Result getByname(Integer num){
        return classroomService.getByName(num);
    }
    @GetMapping("/page")
    public Result page(Integer page,Integer size){
        return classroomService.getPage(page,size);
    }
    @PostMapping
    public Result InsertOrUpdate(@RequestBody Classroom classroom){
        return classroomService.InsertOrUpdate(classroom);
    }
    @DeleteMapping("/{id}")
    public Result delete(@PathVariable Integer id){
        return classroomService.deleteById(id);
    }
    @DeleteMapping
    public Result batchDelete(List<Integer> ids){
        return classroomService.batchDelete(ids);
    }
}
